package soccerBet.project.agenda;

import java.util.Timer;
import java.util.TimerTask;
import java.util.concurrent.Semaphore;

import soccerBet.project.main.ServiceManager;
import soccerBet.project.objects.Jogo;
import soccerBet.project.utils.Display;
import soccerBet.project.utils.Prop;
import soccerBet.project.utils.Utils;

public class Reminder {
	
    Timer timer;


    public Reminder(Jogo jogo, long tempoRestante, Semaphore semaphore) {
        timer = new Timer();
        
        if(Boolean.parseBoolean((String) Prop.properties.get("soccerBet.schedule"))==true){
        	timer.schedule(new RemindTask(jogo,timer,semaphore), tempoRestante);
        	Display.println("Task scheduled to "+Utils.buildGameVs(jogo,false)+" take place in: "+Utils.convertMl2Time(tempoRestante));
        }else
           (new ServiceManager(jogo,semaphore)).start();
        	
	}
    
}